onItemChecked Property |
This is an optional property that contains a pointer to the function to be called when an item in the tree is checked or unchecked.
Syntax
xml |
<TreeItem> <description>sDesc</description> <onitemchecked>fpFunction</ onitemchecked > .. .. .. </TreeItem> |
Parameters
fpFunction |
Pointer to the function that is to be called. |
eventObject |
Refers to the eventObject for this event. It is the last parameter passed for the onItemChecked property. |
Remarks
The parameter passed to the onitemchecked function will contain the item that is selected.
Example
The following example shows how the above property is used.
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd" > <html> <head> <title>onitemchecked example</title> <script src="/cordys/wcp/application.js"></script> </head> <script type="cordys/xml" id="menuData" > <menu> <Continent> <caption>Asia</caption> </Continent> <Continent> <caption>Europe</caption> <description>Europe</description> </Continent> </menu> </script> <script type="cordys/xml" xmlns="" id="MenuTreeSchema" > <TreeSchema> <searchPath>//menu/</searchPath> <Root> <description>Continents</description> <checkable>true</checkable> </Root> <TreeItem id="ContinentID"> <searchPath>Continent</searchPath> <description>caption</description> <checkable>true</checkable> <onitemchecked>handleCheck</onitemchecked> </TreeItem> </TreeSchema> </script> <script type="text/javascript"> function handleCheck(treeItem) { var label = cordys.getTextContent(treeItem.getLabel()); var chk = treeItem.isChecked(); application.notify( label + " checked is " + chk); } </script> <body> <p>Example of the handleCheck property.</p> <div cordysType="wcp.library.ui.Tree" id="myTree" treeData='menuData' treeSchema='MenuTreeSchema'> </div> </body> </html>